When solving complex problems:¶
- Break the problem into smaller pieces
- What is the first goal? What is the second goal?
- Solve the first piece before you start the second piece. Make sure the first piece is working correctly.
- Do NOT try to solve the whole problem all at the same time.
- Don't try to do it all in your head!
- DRAW PICTURES
Goal #1¶
Get Bit to the red square
Goal #2¶
Fill in the trunk
🧑🏼🎨 Blue Ocean¶
Bit gives us move
, paint
, etc.
What new verbs would make this job even easier?
Remember¶
- Choose strategies that minimize uncertainty
- Pick concise but accurate and helpful names for your functions
- Document the purpose and boundary conditions of the function
- What does the function accomplish?
- Where does Bit start? What direction is he facing?
- Where does Bit end? What direction is he facing?
Key ideas¶
- Identifying technical requirements by comparing inputs to a problem
- Practice decomposing complex problems
Key Ideas¶
while
not
- Boundary conditions
- Infinite loops
New Bit methods
bit.can_move_front()
bit.can_move_left()
bit.can_move_right()
bit.is_on_blue()
bit.is_on_green()
bit.is_on_red()
bit.is_on_white()